package com.example.im.interfaces;

import com.example.common.interfaces.CommonCallback;
import com.example.im.bean.MessageBean;
import com.example.im.bean.UserInfoBean;
import com.tencent.imsdk.v2.V2TIMConversationResult;
import com.tencent.imsdk.v2.V2TIMMessage;

import java.util.List;

public interface ImClient {

    /**
     * 初始化 IM（连接 IM 服务器）
     */
    void init();

    /**
     * 登录 IM
     * @param uid
     * @param callback
     */
    void login(String uid, CommonCallback<Boolean> callback);

    /**
     * 登出 IM
     */
    void logout();

    /**
     * 获取会话列表
     * @param nextSeq 拉取起始位置
     * @param count 拉取个数
     * @param callback
     */
    void getConversationList(int nextSeq, int count, CommonCallback<V2TIMConversationResult> callback);

    String getConversationUid();

    void getHistoryMessageList(String uId, int count, V2TIMMessage lastMsg, CommonCallback<List<MessageBean>> callback);

    int getUnReadMsgCount(String uid);

    int getAllUnReadMsgCount();

    void refreshAllUnReadMsg();

    /**
     * 处理消息已读
     *
     * @param uid
     * @param calelback
     * @param needRefresh
     */
    void markConversationAsRead(String uid, boolean needRefresh, CommonCallback<Boolean> calelback);

    MessageBean createTextMessage(String toUid, String text);

    MessageBean createImageMessage(String toUid, String path);

//    void getImageFile(Context context,);

    void setOnMessageListener(CommonCallback<MessageBean> callback);

    void sendTextMessage(String toUid, String text, SendMsgResultCallback callback);

    void sendCustomMessage(String toUid, String customMessage, SendMsgResultCallback callback);

    void sendModelMessage(String toUid, MessageBean messageBean, SendMsgResultCallback callback);

    /**
     * 获取用户信息 ,id逗号隔开
     * 数据包最大为 1M
     * @param uid 用户id
     */
    void getUserInfo(String uid, CommonCallback<List<UserInfoBean>> callback);

    void setOfflinePush(long business,String uid,CommonCallback<Boolean> callback);
}
